﻿using System.Collections.Generic;
using System.Linq;
using StoneAge.DataContract.View;
using StoneAge.Models.Entity;

namespace StoneAge.DataContract.Extension
{
    public static class RoleExtensionMethod
    {
        public static IEnumerable<RoleCatalogView> ConvertToRoleCatalogView(this IEnumerable<Role> roles)
        {
            return roles.Select(r => new RoleCatalogView
            {
                IsLeft = r.IsLeft,
                Name = r.Name,
                CharacterId = r.CharacterId,
                ColorId = r.ColorId,
                ExpressionUpId = r.ExpressionUpId,
                ExpressionDownId = r.ExpressionDownId,
                Level = r.Level.Id,
                Blood = r.MaxBlood,
                Atk = r.Atk,
                Def = r.Def,
                Speed = r.Speed,
                Charm = r.Charm,
                Land = r.Land,
                Water = r.Water,
                Fire = r.Fire,
                Wind = r.Wind,
                Dp = r.Dp,
                LoginCount = r.LoginCount
            });
        }
    }
}
